.TH ELF_GETSCN 3 2024-07-18 "Libelf" "Libelf Programmer's Manual"

.SH NAME
elf_getscn \- retrieve a descriptor for an ELF section at a specified index.

.SH SYNOPSIS
.B #include <libelf.h>

.BI "Elf_Scn *elf_getscn(Elf *" elf ", size_t " index ");"

.SH DESCRIPTION
The
.B elf_getscn
function retrieves a section descriptor for the section at the specified index in the ELF object referred to by
.I elf.

.SH PARAMETERS
.TP
.I elf
An
.I Elf
pointer to the ELF object from which the section descriptor is to be retrieved.

.TP
.I index
A
.I size_t
value representing the index of the section whose descriptor is to be retrieved. Section indices start at 0.  The section at index 0 is always
.B SHT_NULL
and does not contain any data.

.SH RETURN VALUE
The
.B elf_getscn
function returns a pointer to the
.I Elf_Scn
for the section at the specified index. If an error occurs, it returns NULL and sets an appropriate libelf error code.

.SH ATTRIBUTES
For an explanation of the terms used in this section, see
.BR attributes (7).
.TS
allbox;
lbx lb lb
l l l.
Interface	Attribute	Value
T{
.na
.nh
.BR elf_getscn ()
T}	Thread safety	MT-Safe
.TE

.SH SEE ALSO
.BR elf_errno (3),
.BR libelf (3),
.BR elf (5)

.SH REPORTING BUGS
Report bugs to <elfutils-devel@sourceware.org> or https://sourceware.org/bugzilla/.
